<?php
/**
*定时执行任务主文件
*/
class GiftStatisticsDBClass  {

    const EVENT_UPDATE_CLAN_MONEY = 'updateClanMoney';
    const EVENT_UPDATE_CLAN_GIFT = 'updateClanGift';

    private $nowtime = 0;
    private $eventName = '';
    private $timemap = array();


    public function getLastUpdateTime($eventName) {
        $this->eventName = $eventName;
        $lasttime = 0;
        return $lasttime ? $lasttime : strtotime(' - 150 day', $this->nowtime);
    }

    public function getNowtime() {
        return $this->nowtime;
    }

    /**
    *入口文件
    */
    public function statistics($timemap = array()) {
        if (empty($timemap))
            throw new Exception('timemap error');
        if (!$this->eventName) {
            throw new Exception('event empty');
        }
        if (!method_exists($this, $this->eventName)) {
            throw new Exception('mothod  not found!');
        }
        $eventname = $this->eventName;
        $this->$eventname($timemap);
    }

    
    private function endEvent() {
        
    }

}
